package com.company.vo;

import java.util.List;

public class PageResult<T> {
    private List<T> list;       // 当前页数据
    private int totalCount;     // 总条数
    private int pageNum;        // 当前页码
    private int pageSize;       // 每页条数
    private int totalPage;      // 总页数

    // 构造方法（计算总页数）
    public PageResult(List<T> list, int totalCount, int pageNum, int pageSize) {
        this.list = list;
        this.totalCount = totalCount;
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.totalPage = (totalCount + pageSize - 1) / pageSize; // 向上取整
    }

    // getter
    public List<T> getList() { return list; }
    public int getTotalCount() { return totalCount; }
    public int getPageNum() { return pageNum; }
    public int getPageSize() { return pageSize; }
    public int getTotalPage() { return totalPage; }
}